package config

import (
	bootstrapConfig "github.com/liyaozong/mengo/core/base/config"
)

// Struct used to parse the JSON configuration file
type ConfigurationStruct struct {
	Service  bootstrapConfig.ServiceInfo `mapstructure:"service" json:"service" yaml:"service"`
	Database bootstrapConfig.Database    `mapstructure:"db" json:"db" yaml:"db"`
}

type WritableInfo struct {
	LogLevel string
}

func (c *ConfigurationStruct) GetLogLevel() string {
	return ""
}

func (c *ConfigurationStruct) GetListenAddr() string {
	return c.Service.ListenAddr()
}

func (c *ConfigurationStruct) GetDatabaseInfo() *bootstrapConfig.Database {
	// temporary until we can make backwards-breaking configuration.yaml change
	return &c.Database
}
